%
% Calculates the fuzzy euclidean distance squared between two interval represented fuzzy vectors
% of identical dimensionality, and identical alpha values, though the function 
% is agnostic to the actual range of the implicit alpha values of the intervals.
% x1 and x2 should be matricies of dimensionality [N,2*m]
% SPECIAL NOTE: This is not technically a distance metric due to the fact that it does not take the square root of the aggregate
%
function z = fuzzy_euclidean_distance(x1, x2, delta)

sz = size(x1);

count = sz(2) / 2;

if(min(size(x1) == size(x2)) ~= 1)
	error('Size mismatch');
end

if(round(count) ~= count)
	error('Malformed data');
end

if(~exist('delta'))
	delta = 0;
end

z = zeros(size(x1)(1),2);

for ii = 1:count
	if(max(max(abs(x1(:,2*ii-1:2*ii) - x2(:,2*ii-1:2*ii)))) >= delta)
		z = fuzzy_add(z,fuzzy_square(fuzzy_subtract(x1(:,2*ii-1:2*ii), x2(:,2*ii-1:2*ii))));
	end
end
